Skip to content

Fix: Replace ES6 getters/setters with ES5-compatible functions in HTML5 runtime (Closure Compiler error)#27

Closed
gui8515 wants to merge 1 commit intoSortaCore:masterfrom
gui8515:master
Closed

Fix: Replace ES6 getters/setters with ES5-compatible functions in HTML5 runtime (Closure Compiler error)#27
gui8515 wants to merge 1 commit intoSortaCore:masterfrom
gui8515:master

Conversation

@gui8515
Copy link
Contributor

@gui8515 gui8515 commented Nov 25, 2025

Summary

This PR fixes a critical issue preventing Clickteam Fusion 2.5 HTML5 builds when using extensions created with the DarkEdif SDK (SDK v20).
The Fusion HTML5 exporter uses the Google Closure Compiler, which does not support ES6 getters/setters and fails to transpile them to ES5.

Because of this, any extension using DarkEdif v20 cannot be exported as HTML5.


Problem

During HTML5 build, Fusion throws:


ERROR - This code cannot be converted from ES6. ES5 getters/setters (consider using --language_out=ES5)
get setIndexSelected() {
^^^^^^^^^^^^^^^^

This comes from auto-generated code in RuntimePropSet, inside the DarkEdif HTML5 runtime:

get setIndexSelected() {
    return rsDV.getUint16(1 + (2 * 4), true);
},
set setIndexSelected(i) {
    rsDV.setUint16(1 + (2 * 4), i, true);
},

Closure Compiler cannot convert ES6 getters/setters → ES5, so the entire HTML5 build fails.


Solution

Replaced the ES6 getter/setter with ES5-safe functions:

Before (ES6, incompatible)

get setIndexSelected() {
    return rsDV.getUint16(1 + (2 * 4), true);
},
set setIndexSelected(i) {
    rsDV.setUint16(1 + (2 * 4), i, true);
},

After (ES5-compatible)

getSetIndexSelected: function() {
    return rsDV.getUint16(1 + (2 * 4), true);
},
setSetIndexSelected: function(i) {
    rsDV.setUint16(1 + (2 * 4), i, true);
},

Additionally, all internal references were updated:

  • obj.setIndexSelected = xobj.setSetIndexSelected(x)
  • obj.setIndexSelected (read) → obj.getSetIndexSelected()

Why this fix is necessary

✔ Restores HTML5 export support
✔ Keeps full compatibility with Smart Properties
✔ No behavior changes
✔ Only removes ES6 syntax that Closure cannot handle


Impact

  • HTML5 builds now compile successfully.
  • No impact on Windows, Android, or other runtimes.
  • Safe, minimal, runtime-only patch.

Ready to merge

This PR contains the minimal and necessary change to re-enable HTML5 compatibility in DarkEdif SDK v20.

Copilot AI review requested due to automatic review settings February 4, 2026 09:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Fusion comes with Google Closure Compiler, used in Final HTML5 builds to minify the code.
Specifically, CF2.5 comes with v20161201, which doesn't have support for ES6, notably the ES6 getter/setter properties.
(MMF2 last beta comes with v20120430.)

You can tell which version of Closure you have by running
`java.exe -jar "Fusion\Data\Runtime\compiler.jar" -- version`

In CF2.5 build 296.1 and higher, you can specify your own Closure compiler version in Fusion > Tools > Preferences > General tab > HTML5 exporter. It's also possible to swap the jar file out, but Fusion may not understand the results.

However, as of 296.9, the same ES6-incompatible 2016 version is still sent by CT, so we'll keep compatibility to that.
@SortaCore
Copy link
Owner

SortaCore commented Feb 4, 2026

Accepted in commit 43da6cc .

@SortaCore SortaCore closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants